package com.logic.modular.act.fish;

import com.comment.util.message.ResponseResult;
import com.logic.comment.util.JwtUtils;
import com.logic.modular.game.player.fish.service.PlayerFishServiceImpl;
import com.logic.modular.gameCore.config.service.impl.CoreConfigServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/fishAct")
@Api(tags = "钓鱼")
public class FishAction {
    @Resource
    private PlayerFishServiceImpl playerFishService;

    @ApiOperation(value = "开始钓鱼")
    @PostMapping("/start")
    public ResponseResult<?> start(@RequestHeader String token) {
        return ResponseResult.success(playerFishService.start(JwtUtils.getPlayerId(token)));
    }

    @ApiOperation(value = "结束钓鱼")
    @PostMapping("/end")
    public ResponseResult<?> end(@RequestHeader String token) {
        return ResponseResult.success(playerFishService.end(JwtUtils.getPlayerId(token)));
    }

    @ApiOperation(value = "查看钓鱼数据")
    @PostMapping("/select")
    public ResponseResult<?> select(@RequestHeader String token) {
        return ResponseResult.success(playerFishService.obtainPlayerFish(JwtUtils.getPlayerId(token)));
    }

    @ApiOperation(value = "查看钓鱼配置")
    @PostMapping("/config")
    public ResponseResult<?> config() {
        return ResponseResult.success(CoreConfigServiceImpl.getCache(9L));
    }
}
